import org.lionsoul.ip2region.xdb.Searcher;

/**
 * @author yexi
 */
public class RegionUtils {

    /**
     * 根据IP地址查询登录来源
     *
     * @param ipStr ip地址
     * @return 区域信息
     */
    public static String getRegionInfo(String ipStr) {
        try {
            Searcher searcher = Searcher.newWithFileOnly("ip2region/ip2region.xdb");
            //开始查询
            return searcher.searchByStr(ipStr);
        } catch (Exception e) {
            e.printStackTrace();
        }
        //找不到返回空字符串
        return "";
    }

}
